home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Hacks / Hacks ’92 / Scroll O Rama / SBar.c next >
C/C++ Source or Header  |  1992-06-19  |  16KB  |  609 lines

  1. /*    Scroll Bar Pattern CDEV    */
  2. /*    by Jeff Walker            */
  3. /*    © 1991 Walk Soft        */
  4. /*    This Conrol Panel Device allows user to sellect and / or edit the     */
  5. /*    pattern resource for the scroll bar pattern.                        */
  6.  
  7. #include "SBar.h"
  8.  
  9.  
  10. /* Global variables are stored in GlobalStruct */
  11.  
  12. typedef    struct
  13.     {
  14.         int                thePat;
  15.         ControlHandle    scrollBarH;
  16.         int                DidAbout;
  17.         int                IsActive;
  18.     }    GlobalStruct,     **GlobHandle;
  19.     
  20.  
  21. /*    Main:  returns cDevValue.    */
  22.  
  23. pascal long main(int message, int item, int numItems, int cPaneID, 
  24.                 EventRecord *theEvent, long cDevValue, DialogPtr CPDialog)
  25.                 
  26. {
  27.     int             itemType, patNumber, exitCode;
  28.     ControlHandle    theSBH;
  29.     Handle            itemH, tempH;
  30.     Rect            itemRect;
  31.     char            theChar;
  32.     Pattern            blackPat;
  33.     Pattern            greyPat;
  34.     PenState        oldPen;
  35.     
  36.     if (message == macDev)
  37.         return(RunOnAll);
  38.     else if (message == initDev)
  39.         {
  40.  
  41.             if ((exitCode = InitCD(theSBH, &cDevValue, 
  42.                 CPDialog)) != NoError)
  43.                 goto ErrorExit;                                        
  44.  
  45.             return(cDevValue);            
  46.         }
  47.  
  48.     /*    End of initialization routine.    */
  49.  
  50.     if ((cDevValue != cdevUnset) && (cDevValue != ErrorState))
  51.         {
  52.  
  53.             exitCode = NoError;
  54.             patNumber = (**((GlobHandle)cDevValue)).thePat;
  55.             theSBH = (**((GlobHandle)cDevValue)).scrollBarH;
  56.             if (theSBH == NilPtr)
  57.                 {
  58.                     exitCode = cdevResErr;
  59.                     goto ErrorExit;
  60.                 }
  61.             SetCtlValue(theSBH, patNumber);    
  62.             
  63.             switch (message)
  64.                 {
  65.                     case keyEvtDev:
  66.                         if     ((**((GlobHandle)cDevValue)).DidAbout < 1)
  67.                             {
  68.                                 theChar = theEvent->message & charCodeMask;
  69.                                 if ((theChar == '\r') || (theChar == 3))
  70.                                     {
  71.                                         item = OKItem;
  72.                                         if ((exitCode = DoHit(patNumber, theSBH, item, numItems,
  73.                                             theEvent, cDevValue, CPDialog)) != NoError)
  74.                                             goto ErrorExit;
  75.                                     }
  76.                             }                                    
  77.                         break;
  78.  
  79.                     case hitDev:
  80.                         if ((exitCode = DoHit(patNumber, theSBH, item, numItems,
  81.                             theEvent, cDevValue, CPDialog)) != NoError)
  82.                             goto ErrorExit;                                        
  83.                         break;
  84.  
  85.                     case closeDev:
  86.                         exitCode = NilPtr;
  87.     ErrorExit:
  88.                         DisposeControl((**((GlobHandle)cDevValue)).scrollBarH);
  89.                         DisposHandle((Handle)cDevValue);
  90.                         cDevValue = (long)exitCode;
  91.                         break;
  92.                     case updateDev:
  93.                         GetPenState(&oldPen);
  94.                         patNumber = (**((GlobHandle)cDevValue)).thePat;
  95.                         theSBH = (**((GlobHandle)cDevValue)).scrollBarH;
  96.                         GetDItem(CPDialog, PatItem + numItems, 
  97.                             &itemType, &itemH, &itemRect);
  98.                         FrameRect(&itemRect);
  99.                         if ((exitCode = ShowFatPat(patNumber, CPDialog, numItems)) != NoError)
  100.                             goto ErrorExit;
  101.  
  102.                         GetIndPattern(&blackPat, PatternID, 1);
  103.                         GetIndPattern(&greyPat, PatternID, 24);
  104.                         GetDItem(CPDialog, OKItem + numItems, 
  105.                                 &itemType, &itemH, &itemRect);
  106.                         PenSize(3, 3);
  107.                         if ((**((GlobHandle)cDevValue)).IsActive)
  108.                             PenPat(blackPat);
  109.                         else
  110.                             PenPat(greyPat);
  111.                         InsetRect(&itemRect, -4, -4);
  112.                         FrameRoundRect(&itemRect, 16, 16);
  113.                         PenPat(blackPat);
  114.                         break;
  115.                         SetPenState(&oldPen);
  116.                     case macDev:
  117.                         return(RunOnAll);
  118.                         break;                            
  119.                 }
  120.             }
  121.     if (theEvent->what == mouseDown)
  122.         if     ((**((GlobHandle)cDevValue)).DidAbout > 0)
  123.             (**((GlobHandle)cDevValue)).DidAbout--;
  124.     return(cDevValue);
  125. }        
  126.  
  127.  
  128. /*    InitCD:    returns exitCode.  Changes:  cDevValue.  Changes patNumber    */
  129. /*    and the SBH and stores them in the GlobStruct.    Initializes cdev.    */
  130. /*    Used once.  Calls: CopyPat.  Is called by Main only.                */
  131.  
  132. InitCD(ControlHandle theSBH, long *cDevValue, DialogPtr CPDialog)
  133. {
  134.     int            patNumber, myResFile;
  135.     Rect        scrollRect;
  136.     Handle        patNH, tempH;
  137.     PatHandle    theLocalPat, theSysPat;
  138.  
  139.     myResFile = CurResFile();
  140.     if ( (patNH = Get1Resource('patN', PatResID)) == NilPtr)
  141.         return(cdevResErr);
  142.     HLock(patNH);
  143.     patNumber = **patNH;
  144.     HUnlock(patNH);
  145.     
  146.     if ( (patNumber < MinValue) || (patNumber > MaxValue))
  147.             return(cdevMemErr);
  148.  
  149.     if ( (tempH = NewHandle(sizeof(GlobalStruct))) == NilPtr)
  150.         return (cdevMemErr);
  151.     (**((GlobHandle)tempH)).thePat = patNumber;
  152.     (**((GlobHandle)tempH)).DidAbout = FALSE;
  153.     (**((GlobHandle)tempH)).IsActive = TRUE;
  154.  
  155.     scrollRect.top = NRCTBottom - ScrollWidth - 2;
  156.     scrollRect.left = NRCTLeft + 2;
  157.     scrollRect.bottom     = NRCTBottom -2;
  158.     scrollRect.right     = NRCTRight -2;
  159.  
  160.     if (((**((GlobHandle)tempH)).scrollBarH = NewControl(CPDialog, 
  161.         &scrollRect, NilPtr, 1, patNumber, MinValue, MaxValue, 
  162.         scrollBarProc, NilPtr)) == NilPtr)
  163.             return (cdevResErr);
  164.     theSBH = (**((GlobHandle)tempH)).scrollBarH;
  165.     if (theSBH == NilPtr)
  166.         return(cdevMemErr);
  167.  
  168.     SetCtlValue(theSBH, patNumber);
  169.     theLocalPat = GetPattern(SPatResID); /* get the local pattern */
  170.     if (theLocalPat == NilPtr)
  171.         return(cdevResErr);
  172.     HLock(theLocalPat);
  173.     UseResFile(SysResFile);
  174.     theSysPat = GetPattern(SPatResID); /* get the sys pattern */
  175.     if (theSysPat == NilPtr)
  176.         return(cdevResErr);
  177.     HLock(theSysPat);
  178.     CopyPat(*theSysPat, theLocalPat);
  179.  
  180.     HUnlock(theLocalPat);
  181.     HUnlock(theSysPat);
  182.     UseResFile(myResFile);
  183.  
  184.     *cDevValue = (long)tempH;
  185.     
  186.     return(NoError);                                                                                        
  187. }
  188.  
  189.  
  190. /*    DoHit:  Handles HitDev messages.  All user activity comes in the form    */
  191. /*    of HitDev messages.    Returns exitCode.  Changes no parameters.            */
  192. /*    Calls:  DoDefault, DoOk, DoScroll, and ChangeFatPat, and showFatPat        */
  193. /*  Is called by Main only.                                                    */
  194.  
  195. DoHit(int patNumber, ControlHandle theSBH, int item, int numItems, 
  196.     EventRecord *theEvent, long cDevValue, DialogPtr CPDialog)
  197. {
  198.     int        myResFile, exitCode, itemType;
  199.     Rect    itemRect, tempRect;
  200.     Handle    itemH;
  201.  
  202.     myResFile = CurResFile();
  203.     item -= numItems;
  204.  
  205.     if     ((**((GlobHandle)cDevValue)).DidAbout > 0)
  206.         (**((GlobHandle)cDevValue)).DidAbout --;
  207.     else
  208.         {
  209.             switch (item)
  210.                 {
  211.         
  212.                     case DefaultItem:
  213.                         if ((exitCode = DoDefault(&patNumber,theSBH, 
  214.                             numItems, CPDialog, myResFile)) != NoError)
  215.                             return(exitCode);                                        
  216.                         break;
  217.         
  218.                     case OKItem:
  219.                         if ((exitCode = DoOk(patNumber, theSBH, 
  220.                             numItems, CPDialog, myResFile)) != NoError)
  221.                                 return(exitCode);    
  222.                         (**((GlobHandle)cDevValue)).IsActive = FALSE;
  223.                         break;
  224.                         
  225.                     case ScrollBItem:
  226.                         LightButtons(Active, numItems, CPDialog);
  227.                         (**((GlobHandle)cDevValue)).IsActive = TRUE;
  228.         
  229.                         if ( (exitCode = DoScroll(&patNumber, theSBH,
  230.                               theEvent, CPDialog)) != NoError)
  231.                             return(exitCode);                                        
  232.                         if ((exitCode = WritePat(patNumber)) != NoError)
  233.                             return(exitCode);                                        
  234.                         break;
  235.                                 
  236.                     case PatItem:
  237.                         LightButtons(Active, numItems, CPDialog);
  238.                         (**((GlobHandle)cDevValue)).IsActive = TRUE;
  239.         
  240.                         if ( (exitCode = ChangeFatPat(theEvent, CPDialog, numItems)) != NoError)
  241.                             return(exitCode);                                        
  242.                         break;
  243.                     case AboutItem: DoAbout();
  244.                             (**((GlobHandle)cDevValue)).DidAbout = 2;
  245.                         break;            
  246.                     default:
  247.                         ;
  248.                 }
  249.         }                                        
  250.  
  251.     GetDItem(CPDialog, ScrollBItem + numItems, 
  252.         &itemType, &itemH, &itemRect);
  253.     itemRect.bottom -= 1;
  254.     InvalRect(&itemRect);
  255.     if ((exitCode = ShowFatPat(patNumber, CPDialog, numItems)) != NoError)
  256.         return(exitCode);
  257.     (**((GlobHandle)cDevValue)).thePat = patNumber;
  258.     UpdateScroll();
  259.         
  260.     return(NoError);
  261. }
  262.  
  263.  
  264. /*    DoDefault:  Writes the system's origonal pattern to the system pattern    */
  265. /*    In other words, returns the system to its origonal state.                */
  266. /*    returns:  exitCode.  Changes:  patNumber.  Calls:  LightButtons,        */
  267. /*    WritePat, StorePatNum.  Is called by DoHit only.                        */
  268.  
  269. DoDefault(int *patNumber, ControlHandle theSBH, 
  270.             int numItems, DialogPtr CPDialog, int myResFile)
  271. {
  272.     int exitCode = NoError;
  273.     
  274.     UseResFile(SysResFile);
  275.     *patNumber = SysPat + 1;
  276.     if ((exitCode = WritePat(*patNumber)) != NoError)
  277.         return (exitCode);
  278.     SetCtlValue(theSBH, *patNumber);
  279.     LightButtons(Dimmed, numItems, CPDialog);
  280.     UseResFile(myResFile);                                                                                
  281.     if ((exitCode = WritePat(*patNumber)) != NoError)
  282.         return (exitCode);
  283.     if ((exitCode = StorePatNum(*patNumber)) != NoError)
  284.         return (exitCode);
  285.  
  286.     return (exitCode);
  287. }
  288.  
  289.  
  290. /*    DoOk:  Handles the user hitting the OK button.  It copies the pattern    */
  291. /*    that the user has sellected to the system pattern.                        */
  292. /*    Returns:  exitCode.  Changes no parameters.  Calls CopyPat and            */
  293. /*    LightButtons.  Is called by DoHit.                                        */
  294.  
  295. DoOk(int patNumber, ControlHandle theSBH, 
  296.             int numItems, DialogPtr CPDialog, int myResFile)
  297. {
  298.     int            exitCode = NoError;
  299.     PatHandle    theLocalPat, theSysPat;
  300.  
  301.     theLocalPat = GetPattern(SPatResID); /* get the local pattern */
  302.     if (theLocalPat == NilPtr)
  303.         return (cdevResErr);
  304.     HLock(theLocalPat);
  305.     UseResFile(SysResFile);
  306.     theSysPat = GetPattern(SPatResID); /* get the sys pattern */
  307.     if (theSysPat == NilPtr)
  308.         return (cdevResErr);
  309.     HLock(theSysPat);
  310.     CopyPat(*theLocalPat, theSysPat);
  311.     HUnlock(theLocalPat);
  312.     HUnlock(theSysPat);
  313.     LightButtons(Dimmed, numItems, CPDialog);
  314.     UseResFile(myResFile);                                                                                
  315.     if ((exitCode = StorePatNum(patNumber)) != NoError)
  316.         return (exitCode);
  317.  
  318.     return(exitCode);
  319. }
  320.  
  321.  
  322. DoAbout()
  323. {
  324.     Rect    tempRect;
  325.     int        topEdge, leftEdge;
  326.     
  327.     topEdge = NRCTTop + 14;
  328.     leftEdge = NRCTLeft + 40;
  329.     tempRect.top = NRCTTop;
  330.     tempRect.bottom = NRCTBottom - ScrollWidth - 2;
  331.     tempRect.left = NRCTLeft;
  332.     tempRect.right = NRCTRight;
  333.     EraseRect(&tempRect);
  334.     MoveTo(leftEdge, topEdge);
  335.     DrawString("\pScroll O Rama");
  336.     topEdge += 10;
  337.     MoveTo(leftEdge, topEdge);
  338.     DrawString("\pby Jeff Walker");
  339.     topEdge += 10;
  340.     MoveTo(leftEdge, topEdge);
  341.     DrawString("\p© 1991 Walk Soft");
  342.     topEdge += 10;
  343.     MoveTo(leftEdge, topEdge);
  344.     DrawString("\pWrite me at:");
  345.     topEdge += 10;
  346.     MoveTo(leftEdge, topEdge);
  347.     DrawString("\p37904 Summers");
  348.     topEdge += 10;
  349.     MoveTo(leftEdge, topEdge);
  350.     DrawString("\pLivonia, MI 48154");
  351.     while (!Button());
  352.     EraseRect(&tempRect);
  353.     InvalRect(&tempRect);                
  354. }
  355.  
  356.  
  357. /*    DoScroll:  handles the scroll bar.  Tracks where the thumb is moved to    */
  358. /*    and calls the 'PAT#' pattern the corresponds.  Uses SBCB, a code         */
  359. /*    resource which TrackControl uses.  Return exitCode.  Changes: patNumber.*/
  360. /*    Calls no program functions.  Is called by HitDev only.                    */
  361.  
  362. DoScroll(int *patNumber, ControlHandle theSBH, EventRecord *theEvent, 
  363.          DialogPtr CPDialog) 
  364. {    
  365.     Point            thePoint;
  366.     short            thePart;
  367.     ControlHandle    theControl;
  368.     Handle            callBackH;
  369.  
  370.     thePoint = theEvent->where;
  371.     GlobalToLocal(&(thePoint));
  372.     thePart = FindControl(thePoint, CPDialog, &theControl);
  373.     if (theControl == NilPtr)
  374.         return(cdevMemErr);
  375.  
  376.     switch (thePart)
  377.         {
  378.             case inThumb:
  379.                 thePart = TrackControl (theSBH, thePoint, NilPtr);
  380.                 *patNumber = GetCtlValue(theSBH);
  381.                 break;
  382.             default:
  383.                 if ((callBackH = Get1Resource('SBCB', ProcID)) == NilPtr)
  384.                     return(cdevResErr);
  385.                 HLock(callBackH);
  386.                 thePart = TrackControl (theSBH, thePoint, *callBackH);
  387.                 HUnlock(callBackH);
  388.  
  389.                 *patNumber = GetCtlValue(theSBH);                            
  390.                 break;
  391.         }
  392.  
  393.     return(NoError);    
  394. }
  395.  
  396.  
  397. /*    ChangeFatPat:  changes the program's pattern when user edits in the        */
  398. /*    fat-bits box.  Returns exitCode.  Changes the program's pattern.        */
  399. /*    Calls no program functions.  Is called by HitDev only.                    */
  400.  
  401. ChangeFatPat(EventRecord *theEvent, DialogPtr CPDialog, int numItems)
  402. {
  403.     Point            thePoint;
  404.     PatHandle        thePatH;
  405.     int                rowNum, bitNum;
  406.     int                itemType;
  407.     Handle            itemH;
  408.     Rect            itemRect;
  409.     Point            theOrigin;
  410.     
  411.     thePoint = theEvent->where;
  412.     GlobalToLocal(&thePoint);                                
  413.     GetDItem(CPDialog, PatItem + numItems, &itemType, &itemH, &itemRect);
  414.     
  415.     thePatH = (PatHandle)Get1Resource('PAT ', SPatResID);
  416.     if (thePatH == NilPtr)
  417.         return(cdevResErr);
  418.     HLock(thePatH);
  419.  
  420.     thePoint.v -= itemRect.top;
  421.     thePoint.h -= itemRect.left;
  422.     rowNum = thePoint.v / 5;
  423.     if ((rowNum < 0) || (rowNum > 7))
  424.         return(cdevMemErr);
  425.     bitNum = thePoint.h / 5;
  426.     if ((bitNum < 0) || (bitNum > 7))
  427.         {
  428.             SysBeep(9);
  429.             return(cdevMemErr);
  430.         }
  431.  
  432.     if ( BitTst(&((**thePatH)[0, rowNum]), bitNum) )
  433.         BitClr( &((**thePatH)[0, rowNum]), bitNum);
  434.     else
  435.         BitSet( &((**thePatH)[0, rowNum]), bitNum);
  436.  
  437.     ChangedResource(thePatH);
  438.     WriteResource(thePatH);
  439.     HUnlock(thePatH);
  440.     
  441.     return(NoError);    
  442. }
  443.  
  444.  
  445.  
  446. /*    LightButtons:  Changes the hiliting of the OK and Default buttons.        */
  447. /*    Returns nothing.  Changes no parameters.  Calls no functions.  Is        */
  448. /*    called by DoHit.                                                        */
  449.  
  450. LightButtons(int hiliteVal, int numItems, DialogPtr CPDialog)
  451. {
  452.     int                itemType;
  453.     Handle            itemH;
  454.     Rect            itemRect;
  455.     PenState        oldPen;
  456.     Pattern            thePat, blackPat;
  457.  
  458.     GetPenState(&oldPen);
  459.     ShowPen();
  460.  
  461.     GetIndPattern(&thePat, PatternID, 24);
  462.     GetIndPattern(&blackPat, PatternID, 1);
  463.  
  464.     GetDItem(CPDialog, OKItem + numItems, 
  465.             &itemType, &itemH, &itemRect);
  466.     if (hiliteVal == Dimmed)
  467.         {
  468.             PenSize(3, 3);
  469.             PenPat(thePat);
  470.             InsetRect(&itemRect, -4, -4);
  471.             FrameRoundRect(&itemRect, 16, 16);
  472.             PenPat(blackPat);
  473.         }
  474.     else
  475.         {
  476.             PenSize(3, 3);
  477.             PenPat(blackPat);
  478.             InsetRect(&itemRect, -4, -4);
  479.             FrameRoundRect(&itemRect, 16, 16);
  480.         }
  481.  
  482.     SetPenState(&oldPen);
  483.     GetDItem(CPDialog, OKItem + numItems, 
  484.             &itemType, &itemH, &itemRect);
  485.     HiliteControl ((ControlHandle)itemH, hiliteVal);
  486.     GetDItem(CPDialog, DefaultItem + numItems, 
  487.             &itemType, &itemH, &itemRect);
  488.     HiliteControl ((ControlHandle)itemH, hiliteVal);
  489. }
  490.  
  491.  
  492. /*    CopyPat:  Copies the data from one pattern to another.  Usually from     */
  493. /*    the program's pattern to the system pattern - except at initialization.    */
  494. /*    Calls no function.  Is called by:  InitCD, DoHit, DoOk, and WritePat.    */
  495.  
  496. CopyPat(PatPtr patSource, PatHandle patDest)
  497. {
  498.     BlockMove(patSource, *patDest, sizeof(Pattern));
  499.     ChangedResource(patDest);
  500.     WriteResource(patDest);
  501. }
  502.  
  503.  
  504. /*    WritePat:  sellects the 'PAT#' pattern given by patNumber and copies it    */
  505. /*    to the program pattern.  Calls CopyPat.  Is called by:  DoHit and         */
  506. /*    DoDefault.                                                                */
  507.  
  508. WritePat(int patNumber)
  509. {
  510.     Pattern            thePat;
  511.     PatHandle        thePatH;
  512.  
  513.     GetIndPattern(&thePat, PatternID, patNumber);
  514.     thePatH = GetPattern(SPatResID);
  515.     if (thePatH == NilPtr)
  516.         return(cdevResErr);
  517.     HLock(thePatH);
  518.     CopyPat(&thePat, thePatH);
  519.     HUnlock(thePatH);
  520.  
  521.     return(NoError);    
  522. }            
  523.  
  524.  
  525. /*    ShowFatPat:  Displays in fat-bits form the pattern currently in the        */
  526. /*    program.  Returns exitCode.  Changes no parameters.  Calls nothing.        */
  527. /*    Is called by main and DoHit.                                            */
  528.  
  529. ShowFatPat(int patNumber, DialogPtr CPDialog, int numItems)
  530. {
  531.     PatHandle        thePatH;
  532.     int                i;
  533.     int                bitNum;
  534.     int                itemType;
  535.     Handle            itemH;
  536.     Rect            itemRect;
  537.     PenState        oldPen;
  538.     Point            theOrigin;
  539.     
  540.  
  541.     GetPenState(&oldPen);
  542.     ShowPen();
  543.     PenMode(srcCopy);
  544.     PenSize(PenW, PenH);
  545.     GetDItem(CPDialog, PatItem + numItems, &itemType, &itemH, &itemRect);
  546.     InsetRect(&itemRect, 1, 1);
  547.     EraseRect(&itemRect);
  548.     theOrigin.v = itemRect.top;
  549.     theOrigin.h = itemRect.left;
  550.  
  551.     thePatH = (PatHandle)Get1Resource('PAT ', SPatResID);
  552.     if (thePatH == NilPtr)
  553.         return(cdevResErr);
  554.     HLock(thePatH);
  555.         
  556.     for (i= 0; i < 8; i++) 
  557.         {
  558.             for (bitNum = 0; bitNum < 8; bitNum++)
  559.                 {
  560.                     if (BitTst(&((**thePatH)[0, i]), bitNum))
  561.                         {
  562.                             MoveTo(theOrigin.h  + (bitNum) * 5, 
  563.                             theOrigin.v + (i * 5));
  564.                             Line(0, 0);
  565.                         }
  566.                 }
  567.         }                        
  568.     HUnlock(thePatH);
  569.     SetPenState(&oldPen);
  570.  
  571.     return(NoError);    
  572. }
  573.  
  574.  
  575. /*    StorePatNum:  stores the current 'PAT#' pattern number in a resource of    */
  576. /*    of type 'patN'.  This allows for permanent storage of this variable.    */
  577. /*    Returns exitCode.  Changes no paramter.  Calls no functions.  Is called    */
  578. /*    by DoDefault and DoOk.                                                    */
  579.  
  580. StorePatNum(int patNumber)
  581. {
  582.     Handle    patNH;
  583.     
  584.     if ((patNH = Get1Resource('patN', PatResID)) == NilPtr) 
  585.         return(cdevResErr);
  586.     HLock(patNH);
  587.     **patNH = patNumber;
  588.     ChangedResource(patNH);
  589.     WriteResource(patNH);
  590.     HUnlock(patNH);
  591.  
  592.     return(NoError);    
  593. }
  594.  
  595. /*    UpdateScroll:  on systems < 7 it invalidates the scroll bar that        */
  596. /*    belongs to the Control Panel.  Is called by Main.                        */
  597.  
  598. UpdateScroll()
  599. {
  600.     Rect    sysScrollR;
  601.     
  602.     sysScrollR.top = 1;
  603.     sysScrollR.left = 70;
  604.     sysScrollR.bottom = 249;    /* bottom of control panel */
  605.     sysScrollR.right = 88;
  606.  
  607.     InvalRect(&sysScrollR);
  608. }
  609.